package com.hzit.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzit.entity.Emp;
import com.hzit.service.EmpService;
import com.hzit.mapper.EmpMapper;
import com.hzit.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 *
 */
@Service
@Slf4j
public class EmpServiceImpl extends ServiceImpl<EmpMapper, Emp>
    implements EmpService{

	@Autowired
	private RestTemplate restTemplate;

	@Override
	public R findStudentBySid(Integer sid) {
		String url = "http://hzit-student/api/student/findById/" + sid;
		// R r = restTemplate.getForObject("http://hzit-student/student/findById/" + sid, R.class);
		ResponseEntity<R> responseEntity = restTemplate.exchange(url, HttpMethod.GET, null, R.class);
		R r = responseEntity.getBody();
		log.info("r:{}",r);
		return r;
	}
}




